<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="Public/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="Public/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="Public/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="Public/Flat/img/favicon.ico">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	</head>
	<script src="./Public/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function(){
			var com = $('select[name="combine[]"]');
			var len = com.length;
			com.change(function(){
				var remove = {
					'sele':{},
					}
				for (var i=0;i<len;i++){
					if(com.eq(i).val()==0)
					{
						return;
					}else
					{
					 remove.sele[i] = com.eq(i).val()
					}
				}
				$.ajax({
					type:"post",
					url:"<?php echo U('addajax')?>",
					data:remove,
					dataType:"json",
					success:function(data)
					{
						if(data==1){
							alert('货品已存在，如果要修改库存，请点击修改');
						}
					}
				});
			})
		})
	</script>
	<body>
		<table class="table table-hover">
			<tr class="active">
				<th>货品ID</th>
				<?php foreach ($oldtypeattrData as $k=>$v){?>
				<th><?php echo $v['xname']?></th>
				<?php }?>
				<th>库存</th>
				<th>货号</th>
			  <th width="210">操作</th>
			</tr>
			<form method="post">
				<td>添加货品</td>
			  <?php foreach ($oldtypeattrData as $k=>$v){?>
				<td>
					<select name="combine[]">
						<option value="0">-请选择-</option>
						<?php foreach ($v['select'] as $ke=>$va){?>
						<option value="<?php echo $va['oid']?>" <?php foreach ($OldKindsData['combine'] as $kk=>$vv){?><?php if($vv==$va['oid']){?>
                selected=""
               <?php }?><?php }?>><?php echo $va['shopvalue']?></option>
						<?php }?>
					</select>
				</td>
			<?php }?>
				<td>
					<input type="text" name="stock" id="" value="<?php echo $OldKindsData['stock']?>" />
				</td>
				<td>
					<input type="text" name="artno" id="" value="<?php echo $OldKindsData['artno']?>" />
					<input type="hidden" name="goods_hid" id="sid" value="" />
				</td><br />
				<td><input type="submit" value="确认编辑"/></td>
			</form>
				</tr>
		</table>
	</body>
</html>
